import { stringify } from 'querystring';
import request from '@/utils/request';
import { DEFAULT_URL_DEPARTMENT } from '@/constants';

export async function queryData(query, body) {
    return request(`${DEFAULT_URL_DEPARTMENT}/list?${stringify(query)}`, { method: 'POST', body });
}

export async function saveData(option) {
    return request(`${DEFAULT_URL_DEPARTMENT}/insert`, option);
}

export async function updateData(option) {
    return request(`${DEFAULT_URL_DEPARTMENT}/update`, option);
}

// 部门管理 - 部门名称
export async function isduplicate({dept_name, unit_id}) {
    return request(`${DEFAULT_URL_DEPARTMENT}/isduplicate?dept_name=${dept_name}&unit_id=${unit_id}`, { method: 'POST' });
}
